<?php Yii::app()->clientScript->registerScript('commentReplyButton#'.$data->id,"
	jQuery('#commentReplyButton_{$data->id}').click(function() {
		jQuery.ajax({
			url: '".Yii::app()->createUrl('comment/getQuote',array('id'=>$data->id))."',
			type: 'post',
			success: function(data) {
				var comment = jQuery('#Comment_body');
				comment.val(data);
				window.location.hash = 'comment-create';
				jQuery('#Comment_alias').focus();
			}
		});
	});
"); ?>

<a name="comment-<?php echo $data->id; ?>"></a>

<div class="comment-view clearfix<?php echo $index === ($count - 1) ? ' bottom' : ''; ?>">

	<div class="column-left float-left">
		<p class="alias"><?php echo CHtml::encode($data->alias); ?></p>
	</div>

	<div class="column-right float-left">
		<div class="body">
			<?php echo $data->body; // uses CHtmlPurifier to prevent mis-use ?>
		</div>
		<?php if ((bool) $data->edited): ?>
			<div class="edited">
				<?php echo Yii::t('frontend','Edited :date',array(
					':date'=>Yii::app()->dateFormatter->formatDateTime($data->updated,'long','short'),
				)); ?>
			</div>
		<?php endif; ?>
	</div>

	<div class="info">
		<p class="link"><?php echo CHtml::link('#'.$data->id, $data->getUrl()); ?></p>
		<p class="created"><?php echo CHtml::encode($data->getCreatedAgoString()); ?></p>
		<?php if (!Yii::app()->user->isGuest): ?>
			<div class="rate-buttons clearfix">
				<div id="rateContainer_<?php echo $data->id; ?>" class="float-left">
					<?php echo $this->renderPartial('/comment/_rate',array('model'=>$data)); ?>
				</div>
				<div class="report float-right">
					<?php echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl.'/images/icon-warning.png',Yii::t('frontend','Report inappropriate comment')),
							array('comment/report','id'=>$data->id),array(
						'class'=>'twipsify',
						'title'=>Yii::t('frontend','Report inappropriate comment'),
						'confirm'=>Yii::t('frontend','Are you sure you want to report this comment as inappropriate?'),
					)); ?>
				</div>
			</div>
		<?php endif; ?>
	</div>

	<div class="buttons">
		<?php if ($data->creatorId === Yii::app()->user->id || Yii::app()->user->isAdmin): ?>
			<?php echo CHtml::link(Yii::t('frontend','EDIT'),array('comment/update','id'=>$data->id),
					array('class'=>'btn primary')); ?>

			<?php echo CHtml::link(Yii::t('frontend','DELETE'),array('comment/delete','id'=>$data->id),
					array('class'=>'btn primary','confirm'=>Yii::t('frontend','Are you sure you want to delete this comment?'))); ?>
		<?php endif; ?>

		<?php if (!Yii::app()->user->isGuest): ?>
			<?php echo CHtml::link(Yii::t('frontend','REPLY'),'',
					array('id'=>'commentReplyButton_'.$data->id,'class'=>'btn primary')); ?>
		<?php endif; ?>
	</div>

</div>